package domain;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

/**
 * @Author: sszheng
 * @Date: 2018/8/6 10:05
 */
public class PointFactory {
    public static Point newInstance(Integer x, Integer y, String txt) {
        Point point = new Point();
        point.setX(x);
        point.setY(y);
        point.setValue(Integer.valueOf(String.valueOf(txt.charAt(x*9 + y))));
        point.setEmpty(Integer.valueOf(String.valueOf(txt.charAt(x*9 + y))) == 0);
        point.setPossibleValue(initSet());
        return point;
    }

    private static Set<Integer> initSet() {
        return IntStream.range(1, 10).boxed().collect(Collectors.toSet());
    }
}
